function initEdit() {
	$ihelper.createItemList('editUL', [ pass_model.oldPs, pass_model.newPs,pass_model.newPs2 ],
			'edit', null);
	$('#btnSave').click(function() {
		var data = null;
		if ($.validArea("#editPanel")) {
			data = eval("(" +$ihelper.getJson("#editPanel")+")" );
		}
		if(data == undefined || null == data){
			return;
		}else if(data.oldPs == data.newPs){
			alert("新旧密码不能一致!");
		}else if(data.newPs == data.newPs2){
			$.ajax({
		        data: $sw.toJsonStr(data),
		        url: "/v1/p/pass/"+data.newPs+"/"+data.oldPs,
		        type: "POST",
		        cache: false,
		        success: function(data){
		        	if(data == "0"){
		        						alert("成功设置密码!");
		        				}else{
		        					alert("设置密码错误!");
		        				}
		        			},
		        error: function (XMLHttpRequest, textStatus, errorThrown) {  
		        	alert("设置密码错误!");
		        	rebuild(); 
		        	}
		    });
		}else{
			alert("两次输入的新密码不相同!");
		}
	});
	$('#btnReBuild').click(rebuild);
}

function rebuild(){
		$('#editUL').html('');
		initEdit();
}

initEdit();